<jsp:include page="../../header.jsp">
			<jsp:param value="item4" name="item"/>
</jsp:include> 
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="java.io.File"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

  <section class="content">
	<section class="widget"  id="department" >
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>审核信息表</h1>
				<h2>报销审核</h2>
			</hgroup>
		</header>
		<div class="content">
   <div  class="tabs" id="tabs">
	<ul>
    	<li>出差详情</li>
    	<li class="on">报销详情</li>
    </ul>
  <div class="hide">
	<p id="purtitle" >
		<label for="purCode">出差单号:</label>
		<label for="purCode"><s:property value="businessTravelList.travelOrder"/></label>
		
		<label for="purCode">&nbsp;&nbsp;开始时间:</label>
		<label for="purCode"><s:date name="businessTravelList.startTime" format="yyyy-MM-dd" /></label>
			<label for="purCode">结束时间:</label>
		<label for="purCode"><s:date name="businessTravelList.endTime" format="yyyy-MM-dd" /></label>
		<label><a href="javascript:void(0);" id="msg"><font color="#CD3333">差旅标准详情</font></a></label>
		<input type="hidden" name="travelstandrad" id="travelstandrad" value='<s:property value="travelstandrad"/>'>
			<br />
	
		<label for="purCode">&nbsp;&nbsp;职工号:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userid"/></label>  
		
		<label for="purCode">&nbsp;&nbsp;职工姓名:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userName"/></label>
		<label for="purCode">&nbsp;&nbsp;总预算:</label> 
		<label for="purCode"><s:property value="businessTravelList.amount"/></label>
	
		<label for="purCode">&nbsp;&nbsp;状态:</label> 
		<label for="purCode"><s:property value="businessTravelList.verifierStatus"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;审批人:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByVerifierId.userName"/></label>
	</p>
	<form action="applayReimAction!getTravelInfoList.action" name="getTravelInfoList">
	<table id="myTable">
		<tr>
			<th>开始地点</th>
			<th>目的地</th>
			<th>距离/公里</th>
			<th>交通方式</th>
			<th>住宿</th>
			<th>餐饮费/天</th>
			<th>其他费用/天</th>
			<th>天数</th>
			<th>本次费用/元</th>
		</tr>
		<s:iterator value="businessTravels" id="row" status="state">
			<tr>
				 <td align="center">
					<s:property value="#row.startPlace"/>
				</td>
				 <td align="center">
				 	<s:property value="#row.endPlace"/>
				</td>
				<td align="center">
					<s:property value="#row.distance"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.traffic.traffic"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.hotel.hotel"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.mealsCost"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.elseCost"/>
				</td>
				<td align="center">
					<s:property value="#row.time"/>
				</td>
				<td align="center">
					<s:property value="#row.sum"/>
				</td>
			</tr>
		</s:iterator>
	</table>
	</form>
	<a href="verifierAction!getTravelListByStatus.action">返回上一页</a>
 </div>
   <div class="show">
   <form action="verifierAction!alterStatus.action" name="alterStatus" method="post">
	<p id="purtitle" >
	
		<label for="purCode">报销时间:</label>
		<label for="purCode"><s:date name="applayReim.applayTime" format="yyyy-MM-dd" /></label>
		
		<label for="purCode">&nbsp;&nbsp;出差单号:</label> 
		<label for="purCode"><s:property value="businessTravelList.travelOrder"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;职工号:</label> 
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userid"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;姓名:</label> 
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userName"/></label> 
		<label for="purCode">&nbsp;&nbsp;状态:</label>
			<select name="businessTravelList.verifierStatus">
				<option value="待报销">待报销</option>
				<option value="已报销">已报销</option>
				<option value="报销不通过">报销不通过</option>
			</select>
			<br />
		<label for="purCode">申请报销/元:</label>
		<label for="purCode"><s:property value="applayReim.appAmount"/></label> 
		 
		<label for="purCode">&nbsp;&nbsp;预算/元:</label>
		<input type="hidden" id="amount" value=<s:property value="businessTravelList.amount"/>>
		<label for="purCode"><s:property value="businessTravelList.amount"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;实际报销/元:</label>
		 <input type="text" name="applayReim.realAppAmount"  id='realAppAmount'  
					onchange="countSavecost()" 
					maxlength="12"  onkeyup="this.value = this.value.replace(/[^\d.]/g,'')"  onafterpaste="this.value=this.value.replace(/[^\d.]/g,'')" 
					value=<s:property value="applayReim.realAppAmount"/>>
		<label for="purCode">&nbsp;&nbsp;节省/元:</label> 
		<input type="text" readonly="readonly" name="applayReim.saveCost" id="saveCost"
			value=<s:property value="applayReim.saveCost"/>>
		
		
	</p>
	<s:if test="applayReim.applayTime!=null">
						<% 
				int receiptssize = 0;
				if(request.getAttribute("receiptssize")!=null)
				{
					receiptssize = Integer.valueOf(request.getAttribute("receiptssize").toString());
					if(receiptssize>0){
			%>
							<table id="myTable">
								<tr>
									<th colspan="2">收据类型</th>
									<th>文件名</th>
									<th>备注</th>
									<th>操作</th>
								</tr>
								
								
								<s:iterator value="#request.traficeFileMap" status="stuts">
										<tr>
											<td><input name="url" type="checkbox" id="url"
												value="<s:property value="key" />,<s:property value="key" />">
											</td>
											<td>
												交通
											</td>
											<td>
											  <s:property value="key" /> 
											</td>
											<td>
												 <s:property value="value" /> 
											</td>
											<td><input type ="button" class="button white" value="下载" 
												onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
											</td>
											
										</tr>
										
								</s:iterator>
								
								<s:iterator value="#request.mealFileMap" status="stuts">
								
										<tr>
											<td><input name="url" type="checkbox" id="url"
												value="<s:property value="key" />,<s:property value="key" />">
											</td>
											<td>
												餐饮
											</td>
											<td>
											  <s:property value="key" /> 
											</td>
											<td>
												 <s:property value="value" /> 
											</td>
											<td><input type ="button" value="下载"  class="white"
												onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
											</td>
											
										</tr>
									
								</s:iterator>
								
								<s:iterator value="#request.hotelFileMap" status="stuts">
								
										<tr>
											<td><input name="url" type="checkbox" id="url"
												value="<s:property value="key" />,<s:property value="key" />">
											</td>
											<td>
												住宿
											</td>
											<td>
											  <s:property value="key" /> 
											</td>
											<td>
												 <s:property value="value" /> 
											</td>
											<td><input type ="button" value="下载"  class="white"
												onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
											</td>
											
										</tr>
										
								</s:iterator>
								
								<s:iterator value="#request.elseFileMap" status="stuts">
										<tr>
											<td><input name="url" type="checkbox" id="url"
												value="<s:property value="key" />,<s:property value="key" />">
											</td>
											<td>
												其他
											</td>
											<td>
											  <s:property value="key" /> 
											</td>
											<td>
												 <s:property value="value" /> 
											</td>
											<td><input type ="button" value="下载" class="white"
												onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
											</td>
											
										</tr>
										
								</s:iterator>
							</table>
							<div align="center">
							<input type="button" class="white" value="返回上一页" onclick="history.go(-1)">					
								<input class="white" title="选择下载的文件"
									onClick="SelectAll(this.form)" type="button"  value="全选"> 
								<input class="white" title="反向选择下载文件" onClick="TurnOver(this.form)"
									type="button"   value="反选"> 
								<input class="white" title="下载选中文件" onClick="DownlodSelected(this.form)" type="button"
									value="批量下载文件">
							</div>
							<%} }%>
							
						</s:if>
						<s:else>
						<p align="center"><h2><font color="red">没有上传收据</h2>
						<input type="button" class="white" value="返回上一页" onclick="history.go(-1)"></p>
						</s:else>
						<input type="submit"  class="button white" value="提交">
	</form>
</div>
 </div>
 </div>
<script type="text/javascript">
	var tip= document.getElementById("travelstandrad").value;			


	$("#msg").hover(function(){
		layer.tips(tip,"#msg",{
			tips:[1,"#3595cc"]
		});
	
	});
	//下载文件
	function downloadFile1(filenames, filepaths) {
		location.href = encodeURI("downloadAction.action?filenames=" + filenames
				+ "&filepaths=" + filepaths, "utf-8");
	}
	function SelectAll(oForm) {
		for ( var i = 0; i < oForm.url.length; i++) {
			oForm.url[i].checked = true;
		}
	}
	function TurnOver(oForm) {
		for ( var i = 0; i < oForm.url.length; i++) {
			oForm.url[i].checked = !oForm.url[i].checked;
		}
	}
	function DownlodSelected(oForm) {
		if (confirm("因需要在服务端动态打包,需要时间比较长,是否继续批量下载?")) {
			var arrDownloadList = [];
			for ( var i = 0; i < oForm.url.length; i++) {
				if (oForm.url[i].checked == true) {
					if (arrDownloadList.length == 0) {
						arrDownloadList[0] = oForm.url.value;
					}
					arrDownloadList[arrDownloadList.length] = oForm.url[i].value;
				}
			}
			if (arrDownloadList.length > 0) {
				var temp = [];
				var filenames = "";
				var filepaths = "";
				for ( var i = 1; i < arrDownloadList.length; i++) {
					temp = arrDownloadList[i].split(",")
					if (filenames == "" && filepaths == "") {
						filenames = temp[0]
						filepaths = temp[1]
					} else {
						filenames = filenames + "|" + temp[0];
						filepaths = filepaths + "|" + temp[1];
					}
				}
				downloadFile1(filenames, filepaths);
			} else {
				alert("还没有选中下载项");
			}
		}
	}
 			 var oTab = document.getElementById("tabs");
           var oUl = oTab.getElementsByTagName("ul")[0];
           var oLis = oUl.getElementsByTagName("li");
           var oDivs= oTab.getElementsByTagName("div");

           for(var i= 0,len = oLis.length;i<len;i++){  
               oLis[i].index = i;
               oLis[i].onclick = function() {
                   for(var n= 0;n<len;n++){
                       oLis[n].className = "";
                       oDivs[n].className = "hide";//隐藏的类名
                   }
	               this.className = "on";//显示的类名
	               oDivs[this.index].className = "";
	               var index = this.index;
                   
               };
           }
          
             //计算节省费用
	function countSavecost(){
		var realAppAmount = document.getElementById("realAppAmount").value;
		var amount = document.getElementById("amount").value;
		
		if((/^-?\d+\.?\d{0,2}$/.test(realAppAmount))){
			if(realAppAmount == 0){
				realAppAmount=0;
			}
			var saveCost = amount- realAppAmount;
			document.getElementById("realAppAmount").value = realAppAmount;
			document.getElementById("saveCost").value = saveCost;
		}
		else{
		alert("请输入范围在000000000.00~999999999.99的至多两位小数的数字");
			document.getElementById("realAppAmount").value = 0;
			document.getElementById("saveCost").value  = amount;
		}
			
	}
	

	
</script>
 <%@ include file="../../footer.jsp" %>
